package leetcode_301_400;

public class LeeCode_326 {
    public static void main(String[] args) {
        System.out.println(isPowerOfThree(0));
    }
    private static boolean isPowerOfThree(int n) {
        if (n <= 0)
            return false;
        while (n > 1){
            if (n % 3 != 0)
                return false;
            n /= 3;
        }
        return true;
    }
}
